home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / Tool Chest / Development Platforms / Macintosh Common Lisp Related / interfaces / PInterface Translator / PInterfaces / ImageCodec.p < prev    next >
Encoding:
Text File  |  1993-09-16  |  6.1 KB  |  211 lines  |  [TEXT/MPS ]

  1. {
  2.  
  3. Created: Tuesday, October 13, 1992 
  4.  ImageCodec.p
  5.  Pascal Interface to the Macintosh Libraries
  6.  
  7.  
  8.  Copyright Apple Computer, Inc. 1991, 1992
  9.  All rights reserved
  10.  
  11. }
  12.  
  13. {$IFC UNDEFINED UsingIncludes}
  14. {$SETC UsingIncludes := 0}
  15. {$ENDC}
  16.  
  17. {$IFC NOT UsingIncludes}
  18.  UNIT ImageCodec;
  19.  INTERFACE
  20. {$ENDC}
  21.  
  22. {$IFC UNDEFINED UsingImageCodec}
  23. {$SETC UsingImageCodec := 1}
  24.  
  25. {$I+}
  26. {$SETC ImageCodecIncludes := UsingIncludes}
  27. {$SETC UsingIncludes := 1}
  28. {$IFC UNDEFINED UsingQuickDraw}
  29. {$I $$Shell(PInterfaces)QuickDraw.p}
  30. {$ENDC}
  31. {$IFC UNDEFINED UsingQDOffscreen}
  32. {$I $$Shell(PInterfaces)QDOffscreen.p}
  33. {$ENDC}
  34.  
  35. {$IFC UNDEFINED UsingTypes}
  36. {$I $$Shell(PInterfaces)Types.p}
  37. {$ENDC}
  38.  
  39. {$IFC UNDEFINED UsingComponents}
  40. {$I $$Shell(PInterfaces)Components.p}
  41. {$ENDC}
  42.  
  43. {$IFC UNDEFINED UsingImageCompression}
  44. {$I $$Shell(PInterfaces)ImageCompression.p}
  45. {$ENDC}
  46.  
  47.  
  48. {$SETC UsingIncludes := ImageCodecIncludes}
  49.  
  50.  
  51. {    codec component selectors    }
  52. {    codec selectors 0-127 are reserved by Apple }
  53. {    codec selectors 128-191 are subtype specific }
  54. {    codec selectors 192-255 are vendor specific }
  55. {     codec selectors 256-32767 are reserved by Apple }
  56. {    negative selectors are reserved by the Component Manager }
  57.  
  58. CONST
  59. codecGetCodecInfo                    = $00;
  60. codecGetCompressionTime                = $01;
  61. codecGetMaxCompressionSize            = $02;
  62. codecPreCompress                    = $03;
  63. codecBandCompress                    = $04;
  64. codecPreDecompress                    = $05;
  65. codecBandDecompress                    = $06;
  66. codecCDSequenceBusy                    = $07;
  67. codecGetCompressedImageSize            = $08;
  68. codecGetSimilarity                    = $09;
  69. codecTrimImage                        = $0a;
  70.  
  71.  
  72. {    codec capabilities flags    }
  73.  
  74. codecCanScale                        = $1;
  75. codecCanMask                        = $2;
  76. codecCanMatte                        = $4;
  77. codecCanTransform                    = $8;
  78. codecCanTransferMode                = $10;
  79. codecCanCopyPrev                    = $20;
  80. codecCanSpool                        = $40;
  81. codecCanClipVertical                = $80;
  82. codecCanClipRectangular                = $100;
  83. codecCanRemapColor                    = $200;
  84. codecCanFastDither                    = $400;
  85. codecCanSrcExtract                    = $800;
  86. codecCanCopyPrevComp                = $1000;
  87. codecCanAsync                        = $2000;
  88. codecCanMakeMask                    = $4000;
  89. codecCanShift                        = $8000;
  90.  
  91. TYPE
  92. CodecCapabilitiesPtr =  ^CodecCapabilities;
  93. CodecCapabilities = RECORD
  94.     flags:    LONGINT;
  95.     wantedPixelSize: INTEGER;
  96.     extendWidth: INTEGER;
  97.     extendHeight: INTEGER;
  98.     bandMin: INTEGER;
  99.     bandInc: INTEGER;
  100.     pad: INTEGER;
  101.     time: INTEGER;
  102. END;
  103.  
  104. CONST
  105. codecConditionFirstBand                = $1;    
  106. codecConditionLastBand                = $2;
  107. codecConditionFirstFrame            = $4;
  108. codecConditionNewDepth                = $8;
  109. codecConditionNewTransform            = $10;
  110. codecConditionNewSrcRect            = $20;
  111. codecConditionNewMask                = $40;
  112. codecConditionNewMatte                = $80;
  113. codecConditionNewTransferMode        = $100;
  114. codecConditionNewClut                = $200;
  115. codecConditionNewAccuracy            = $400;
  116. codecConditionNewDestination        = $800;
  117. codecConditionCodecChangedMask        = $80000000;
  118.  
  119.  
  120. codecInfoResourceType    =    'cdci';                    { codec info resource type }
  121. codecInterfaceVersion = 1;
  122.  
  123.  
  124. TYPE
  125. CodecCompressParamsPtr = ^CodecCompressParams;
  126. CodecCompressParams = RECORD
  127.     sequenceID :ImageSequence ;                        { precompress,bandcompress }
  128.     imageDescription: ImageDescriptionHandle;        { precompress,bandcompress }
  129.     data : Ptr;
  130.     bufferSize : LONGINT;
  131.     frameNumber: LONGINT;
  132.     startLine: LONGINT;
  133.     stopLine: LONGINT;
  134.     conditionFlags: LONGINT;
  135.     callerFlags : CodecFlags;
  136.     capabilities : CodecCapabilitiesPtr;            { precompress,bandcompress }
  137.     progressProcRecord : ProgressProcRecord;
  138.     completionProcRecord : CompletionProcRecord;    
  139.     flushProcRecord : FlushProcRecord;
  140.     srcPixMap  :PixMap;                                { precompress,bandcompress }
  141.     prevPixMap : PixMap;
  142.     spatialQuality : CodecQ;
  143.     temporalQuality : CodecQ;
  144.     similarity : fixed;
  145.     reserved: ARRAY [0..1] OF LONGINT;        
  146. END;
  147.  
  148. CodecDecompressParamsPtr = ^CodecDecompressParams;
  149. CodecDecompressParams = RECORD
  150.     sequenceID : ImageSequence;                        { predecompress,banddecompress }
  151.     imageDescription : ImageDescriptionHandle;        { predecompress,banddecompress }
  152.     data : Ptr;
  153.     bufferSize : LONGINT;
  154.     frameNumber : LONGINT;
  155.     startLine : LONGINT;
  156.     stopLine : LONGINT;
  157.     conditionFlags : LONGINT;
  158.     callerFlags : CodecFlags;
  159.     capabilities : CodecCapabilitiesPtr;            { predecompress,banddecompress }
  160.     progressProcRecord : ProgressProcRecord;
  161.     completionProcRecord : CompletionProcRecord;
  162.     dataProcRecord : DataProcRecord;
  163.     port : CGrafPtr;                                { predecompress,banddecompress }
  164.     dstPixMap : PixMap;                                { predecompress,banddecompress }
  165.     maskBits : BitMapPtr;
  166.     mattePixMap : PixMapPtr;
  167.     srcRect : Rect;                                    { predecompress,banddecompress }
  168.     matrix : MatrixRecordPtr;                        { predecompress,banddecompress }
  169.     accuracy : CodecQ;                                { predecompress,banddecompress }
  170.     transferMode : INTEGER;                            { predecompress,banddecompress }
  171.     reserved : ARRAY [0..1] OF LONGINT;                
  172. END;
  173.  
  174.  
  175. FUNCTION CDGetCodecInfo(storage : Handle;VAR info: CodecInfo) : ComponentResult;
  176.  
  177. FUNCTION CDGetCompressionTime(storage : Handle; src: PixMapHandle; srcRect : Rect;  depth  :INTEGER ;
  178.      VAR spatialQuality: CodecQ; VAR temporalQuality: CodecQ;VAR time: LONGINT): ComponentResult;
  179.  
  180. FUNCTION CDGetMaxCompressionSize(storage : Handle; src : PixMapHandle; srcRect : Rect; 
  181.     depth : INTEGER; quality : CodecQ;VAR size : LONGINT) : ComponentResult;
  182.  
  183. FUNCTION CDPreCompress(storage : Handle;params : CodecCompressParamsPtr) : ComponentResult;
  184.  
  185. FUNCTION CDBandCompress(storage : Handle;params: CodecCompressParamsPtr) : ComponentResult;
  186.  
  187. FUNCTION CDPreDecompress(storage : Handle;params: CodecDecompressParamsPtr) : ComponentResult;
  188.  
  189. FUNCTION CDBandDecompress(storage : Handle;params: CodecDecompressParamsPtr) : ComponentResult;
  190.  
  191. FUNCTION CDCodecBusy(storage : Handle;seq : ImageSequence) : ComponentResult;
  192.  
  193. FUNCTION CDGetCompressedImageSize(storage : Handle; desc : ImageDescriptionHandle;data : PTR;
  194.     bufferSize :LONGINT;  dataProc : DataProcRecordPtr;VAR dataSize: LONGINT) : ComponentResult;
  195.  
  196. FUNCTION CDGetSimilarity(storage : Handle; src : PixMapHandle; srcRect : Rect;
  197.      desc : ImageDescriptionHandle; data : Ptr; VAR similarity : Fixed) : ComponentResult;
  198.  
  199. FUNCTION CDTrimImage(storage : Handle; desc : ImageDescriptionHandle; inData: Ptr; inBufferSize : LONGINT; 
  200.      dataProc : DataProcRecordPtr; outData : Ptr; outBufferSize : LONGINT; 
  201.      flushProc : FlushProcRecordPtr; VAR trimRect : Rect; progressProc : ProgressProcRecordPtr) : ComponentResult;
  202.  
  203.  
  204.  
  205. {$ENDC} { UsingImageCodec }
  206.  
  207. {$IFC NOT UsingIncludes}
  208.  END.
  209. {$ENDC}
  210.  
  211.